home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / stut_src / vdi.c < prev    next >
C/C++ Source or Header  |  1996-05-27  |  18KB  |  690 lines

  1. /*
  2.  * vdi.c
  3.  *
  4.  * History:
  5.  * --------
  6.  * 1993: fplanque: Created
  7.  */
  8.  
  9.      #include "!OPTIONS.H"                /* Options de compilation */         
  10.     #define    THIS_FILE    "VDI.C v1.00 - 02.95"
  11.  
  12. /*
  13.  * System headers:
  14.  */
  15.     #include    <stdio.h>
  16.     #include <string.h>                    /* header tt de chaines */
  17.     #include    <aes.h>                            /* Qques infos sont tjs n‚cessaires! */
  18.     #include    <vdi.h>
  19. /*    #include    <stdlib.h>                        /* malloc */
  20.    
  21.  
  22. /*
  23.  * Custom headers:
  24.  */
  25.     #include    "SPEC_PU.H"
  26.     #include "S_MALLOC.H"
  27.     #include "STUT_ONE.RSC\STUT_3.H"                    /* noms des objets ds le ressource */
  28.     #include    "DESK_PU.H"    
  29.     #include "WIN_PU.H"    
  30.     #include "TEXT_PU.H"
  31.     #include    "DEBUG_PU.H"    
  32.     #include    "RTERR_PU.H"    
  33.     #include    "VDI_PU.H"    
  34.  
  35. /*
  36.  * ------------------------ VARIABLES -------------------------
  37.  */
  38.     
  39.     
  40. /*
  41.  * External variables: 
  42.  */
  43.     /* 
  44.      * Ic“nes: 
  45.      */
  46.     extern     int    G_arbocell_w;                    /* Larg d'une ic“ne arbo */
  47.     extern    int    G_arbocell_h;                    /* Hauteur... */
  48.  
  49. /*
  50.  * Public variables: 
  51.  */
  52.     /* 
  53.      * G‚n‚ral VDI: 
  54.      */
  55.     int        G_aesws_handle;            /* Handle WStation AES */
  56.     int        G_ws_handle;                /* Handle virtual WorkStation VDI */
  57.     int        G_work_in[11];                /* VDI G_work_in */
  58.     int        G_work_out[57];            /* VDI work out */
  59.     int       G_pxyarray[18];            /* Liste de coord X,Y pour le VDI */
  60.     int        G_pxyarray2[10];    
  61.     int        G_cliparray[ 4 ];
  62.     MFDB        G_plogMFDB;                    /* MFDB pour l'‚cran */
  63.     /* 
  64.      * ParamŠtres supp: 
  65.      */
  66.     int        G_nb_bitplanes;            /* Nbre de plans graphiques */
  67.     int        G_nb_colors;                /* Nbre de couleurs simultan‚es */
  68.     /* 
  69.      * Tampon AES: 
  70.      */
  71.     char        *G_tampon_aes;                /* Adr tampon */
  72.     size_t    G_long_tampon;                /* Longueur de ce tampn */
  73.     MFDB        G_tamponMFDB;                /* MFDB pour le tampon AES */
  74.  
  75.     VDI_TEXT_PARAMS    G_aes_text;            /* ParamŠtres texte AES */
  76.     VDI_TEXT_PARAMS    G_std_text;            /* ParamŠtres du texte standard */    
  77.     int                    G_cell_size_prop;    /* Rapport Hauteur/Largeur d'un emplacement caractŠre standard */
  78.     TEXTSIZE_DEF    *    G_textsize_map;        /* Tableau des tailles de caractŠres */
  79.     int                    G_nb_textsizes=0;    /* Nbre de tailles de texte */
  80.     /* 
  81.      * Userdefs: 
  82.      */
  83.     USERBLK    G_bcroix_ublk = { bouton_croix, 0L };    /* Adr routine , Ob SPEC */    
  84.  
  85.     
  86. /*
  87.  * Private variables: 
  88.  */
  89.     /* 
  90.      * Motif de ligne pour fantômes d'icône: 
  91.      */
  92.     static    int    M_motif[]={ 0x5555, 0xAAAA, 0xAAAA, 0x5555 };
  93.      
  94.  
  95. /*
  96.  * ------------------------ FUNCTIONS -------------------------
  97.  */
  98.  
  99. /*
  100.  * init_vdi(-)
  101.  *
  102.  * Purpose:
  103.  * --------
  104.  * Initialisation VDI
  105.  *
  106.  * History:
  107.  * --------
  108.  * 1993: fplanque: Created
  109.  * 25.05.94: fplanque: initialisation des paramŠtres de remplissage VDI
  110.  * 17.10.94: corrig‚ bug des tailles de cars en COULEUR qui durait depuis plus d'un an! ouf :))
  111.  */
  112. void    init_vdi( void )
  113. {
  114.     TEXTSIZE_DEF    *textsize_ptr;
  115.     int    point=4;                                    /* Arbitraire */
  116.     int    char_w, char_h, cell_w, cell_h;
  117.     int    i, foo;
  118.  
  119.     /*
  120.      * Tampon AES: 
  121.      */
  122.     unsigned    int    adr_low, adr_high, len_low, len_high;
  123.  
  124.     TRACE0( "Initializing " THIS_FILE );
  125.  
  126.     /*
  127.      * Handle WorkStation VDI utilis‚e par l'AES: 
  128.      */
  129.     G_aesws_handle = graf_handle( &(G_aes_text .cell_w), &(G_aes_text .cell_h),
  130.                                 &foo, &foo );
  131.     if( G_aesws_handle == 0 )
  132.     {
  133.         erreur( "[3][|"
  134.                         "L'interface graphique AES|"
  135.                         "ne peut pas ˆtre utilis‚e!]"
  136.                         "[ Quitter ]");
  137.     }
  138.     /* TRACE2( "Texte AES: W=%d H=%d", G_aes_text .cell_w, G_aes_text .cell_h ); */
  139.                         
  140.     /*
  141.      * Ouverture de la station de travail ‚cran: 
  142.      */
  143.     G_ws_handle = G_aesws_handle;        /* Je crois que CA c'est inutile! */
  144.  
  145.     for( i=0; i<10; G_work_in[ i++ ] = 1 )    /* Initialise tableau de variables */
  146.         ;
  147.         
  148.     G_work_in[ 7 ]    = 0;        /* Type de remplissage: vide */
  149.     G_work_in[ 10 ] = 2;        /* Coordonn‚es RC */
  150.     v_opnvwk( G_work_in, &G_ws_handle, G_work_out );
  151.     if( G_ws_handle == 0 )
  152.     {
  153.         erreur( "[3][|"
  154.                         "L'interface graphique VDI|"
  155.                         "ne peut pas ˆtre utilis‚e!]"
  156.                         "[ Quitter ]");
  157.     }
  158.  
  159.     /*
  160.      * R‚colte paramŠtres: 
  161.      */
  162.     G_nb_colors = G_work_out[ 13 ];        /* Nombre de couleurs simultan‚es */
  163.     /* TRACE0( "V_OPNVWK; Informations retourn‚es:" ); */
  164.     /* TRACE1( "  Nb tailles de caractŠres=%d", G_work_out[5] ); */
  165.     /* TRACE1( "  + Petite taille=%d", G_work_out[46] ); */
  166.     /* TRACE1( "  + Grande taille=%d", G_work_out[48] ); */
  167.  
  168.  
  169.     /*
  170.      * --------------------------------
  171.      * Fixe paramŠtres compl‚mentaires: 
  172.      * --------------------------------
  173.      * vsf_perimeter: Par d‚faut, les formes dessin‚es n'ont pas
  174.      * de contour (perimetre). Cet attribut devra toujours etre remis
  175.      * … NO0 aprŠs utilisation.
  176.      */
  177.     vsf_perimeter( G_ws_handle, NO0 );
  178.  
  179.     /*
  180.      * vsf_interior: Par d‚faut, les formes dessin‚es le sont en couleur
  181.      * de fond/vide/0/blanc. Cet attribut devra tjs etre remis …
  182.      * FIS_HOLLOW aprŠs utilisation.
  183.      */
  184.     vsf_interior( G_ws_handle, FIS_HOLLOW );    /* remplissage: VIDE(blanc) */
  185.  
  186.     /*
  187.      * vswr_mode: Par d‚faut, les formes sont dessin‚es en mode REPLACE
  188.      * Cet attribut devra tjs etre remis … MD_REPLACE aprŠs utilisation.
  189.      */
  190.     vswr_mode( G_ws_handle, MD_REPLACE );
  191.  
  192.     /*
  193.      * Sauvegarde des paramŠtres texte standards: 
  194.      */
  195.     vqt_attributes( G_ws_handle, (int *) &G_std_text );
  196.     /* TRACE2( "Std text: Font:%d  Color:%d", G_std_text.font, G_std_text.color ); */
  197.     /* TRACE2( "Std text: W:%d  H:%d",  G_std_text.cell_w, G_std_text.cell_h ); */
  198.  
  199.     /*
  200.      * Calcul la ratio hauteur/largeur des caractŠres:
  201.      */
  202.     G_cell_size_prop = G_std_text .cell_h / G_std_text .cell_w;
  203.     /* printf( "\nh:%d w:%d ratio:%d", G_std_text .cell_h, G_std_text .cell_w, G_cell_size_prop ); */
  204.  
  205. #if ! ACCEPT_SMALLFONTS
  206.     if( G_std_text .cell_h != 16 )
  207.     {
  208.         erreur( "[3][Cette version de Stut One ne|"
  209.                         "peut adresser GEM-AES que dans|"
  210.                         "les r‚solutions o— les caractŠres|"
  211.                         "font 16 lignes de haut. Exemple|"
  212.                         "de problŠme: Moyenne ST 640*200.]"
  213.                         "[ Quitter ]");
  214.     }
  215. #endif
  216.  
  217.     /*
  218.      * Cr‚ation du tableau des tailles de caractŠres: 
  219.      */
  220.     G_textsize_map = (TEXTSIZE_DEF *) MALLOC( sizeof( TEXTSIZE_DEF ) * DEFNB_TEXTSIZES );
  221.     textsize_ptr = G_textsize_map;
  222.     
  223.     /*
  224.      * Recherche la premiŠre taille:
  225.      */
  226.     vst_point( G_ws_handle, point, &char_w, &char_h, &cell_w, &cell_h);
  227.     do
  228.     {
  229.  
  230.         textsize_ptr -> points     = point;
  231.         textsize_ptr -> char_h    = char_h;
  232.         textsize_ptr -> cell_w    = cell_w;
  233.         textsize_ptr -> cell_h    = cell_h;
  234.  
  235.         point ++ ;
  236.  
  237.         vst_point( G_ws_handle, point, &char_w, &char_h, &cell_w, &cell_h);
  238.  
  239.     } while(    (cell_w == textsize_ptr -> cell_w) && (cell_h == textsize_ptr -> cell_h) );
  240.     G_nb_textsizes++;        /* 1 taille de plus! */
  241.  
  242.     /*
  243.      * Corrige taille courante de maniŠre … reflŠter la 1ere taille ds point
  244.      */
  245.     point --;
  246.  
  247.     /*
  248.      * Test des tailles suivantes disponibles 
  249.      */
  250.     while    ( G_nb_textsizes < DEFNB_TEXTSIZES )
  251.     {
  252.         do
  253.         {
  254.             point++;
  255.  
  256.             /* TRACE1( "  Going over: %d points", point ); */
  257.             vst_point( G_ws_handle, point, &char_w, &char_h, &cell_w, &cell_h);
  258.         } while( point < DEF_MAXSIZE && cell_w == textsize_ptr -> cell_w && cell_h == textsize_ptr -> cell_h);
  259.  
  260.         if ( point >= DEF_MAXSIZE )
  261.         {
  262.             break;
  263.         }
  264.         else
  265.         {    /*
  266.              * On sauve la taille courante: 
  267.              */
  268.             /* TRACE1( "  Saving %d points", point ); */
  269.             textsize_ptr++;            /* Passe … l'emplacement suivant */
  270.             textsize_ptr -> points     = point;
  271.             textsize_ptr -> char_h    = char_h;
  272.             textsize_ptr -> cell_w    = cell_w;
  273.             textsize_ptr -> cell_h    = cell_h;
  274.             G_nb_textsizes++;        /* 1 taille de plus! */
  275.         }
  276.     }
  277.  
  278.     /*
  279.      * R‚duit la zone de stockage au strict n‚cessaire 
  280.      */
  281.     G_textsize_map = (TEXTSIZE_DEF *) REALLOC( G_textsize_map, sizeof( TEXTSIZE_DEF ) * G_nb_textsizes );
  282.  
  283.     /*
  284.      * Affiche les tailles trouv‚es: 
  285.      */
  286.     /*for ( i=0; i < G_nb_textsizes; i++ )
  287.       {
  288.          TRACE3( "   Pts:%d  Char_h:%d  Cell_h:%d", G_textsize_map[i].points, G_textsize_map[i].char_h, G_textsize_map[i].cell_h);
  289.       }
  290.      */ 
  291.     
  292.     /*
  293.      * Trouve taille du texte par d‚faut: 
  294.      */
  295.     for ( i=0; i<G_nb_textsizes; i++ )
  296.     {
  297.         if    (     G_std_text .cell_w == G_textsize_map[ i ] .cell_w
  298.             && G_std_text .cell_h == G_textsize_map[ i ] .cell_h )
  299.             break;
  300.     }
  301.  
  302.     if( i == G_nb_textsizes )
  303.     {
  304.         signale( "ERR: Pas trouv‚ taille texte par d‚faut!" );
  305.     }
  306.  
  307.     G_std_text.points =    G_textsize_map[ i ] .points;
  308.     /* TRACE1( "Taille texte standard: %d points.", G_std_text.points ); */
  309.  
  310.     /*
  311.      * Memory Form Definition Block pour l'‚cran logique 
  312.      */
  313.     G_plogMFDB.fd_addr=0;
  314.     G_plogMFDB.fd_w=0;                /* Largeur en pixels */
  315.     G_plogMFDB.fd_h=0;                /* Hauteur en pixels */
  316.     G_plogMFDB.fd_wdwidth=0;        /* Blockbreite in Integern  */
  317.    G_plogMFDB.fd_stand=0;            /* 0 = ger„teabh„ngiges Format
  318.                                      1 = Standardformat       */
  319.     G_plogMFDB.fd_nplanes=0;        /* Nb plans */
  320.     G_plogMFDB.fd_r1=0;                /* R‚serv‚ */
  321.     G_plogMFDB.fd_r2=0;                /* R‚serv‚ */
  322.     G_plogMFDB.fd_r3=0;                /* R‚serv‚ */
  323.  
  324.     /*
  325.      * Demande paramŠtres 
  326.      */
  327.     vq_extnd( G_ws_handle, 1, G_work_out );
  328.     G_nb_bitplanes = G_work_out[ 4 ];    /* Nombre de plans graphiques */
  329.     /* printf("Nbre de plans:%d \n",G_work_out[4]); */
  330.  
  331.     /*
  332.      * Demande zone tampon aes: 
  333.      */
  334.     wind_get( 0, WF_SCREEN, &adr_high, &adr_low, &len_high, &len_low);
  335.     G_tampon_aes = (char *) (( (unsigned long)adr_high <<16) | adr_low);
  336.     G_long_tampon= ( (unsigned long)len_high <<16) | len_low;
  337.     /*    printf("Tampon AES: %lu %lu\n",G_tampon_aes,G_long_tampon); */
  338.  
  339.     /*
  340.      * Memory Form Definition Block pour le tampon AES: 
  341.      */
  342.     G_tamponMFDB.fd_addr=G_tampon_aes;
  343.     G_tamponMFDB.fd_w=0;                /* Largeur en pixels (set by RUNTIME) */
  344.     G_tamponMFDB.fd_h=0;                /* Hauteur en pixels (set by RUNTIME) */
  345.     G_tamponMFDB.fd_wdwidth=0;        /* Taille en mots d'un seul plan d'une seule ligne (set by RUNTIME)  */
  346.    G_tamponMFDB.fd_stand=1;        /* 0 = ger„teabh„ngiges Format
  347.                                          1 = Standardformat       */
  348.     G_tamponMFDB.fd_nplanes=G_nb_bitplanes;    /* Nb plans */
  349.     G_tamponMFDB.fd_r1=0;                /* R‚serv‚ */
  350.     G_tamponMFDB.fd_r2=0;                /* R‚serv‚ */
  351.     G_tamponMFDB.fd_r3=0;                /* R‚serv‚ */
  352.  
  353.     /*    getchar(); */
  354. }
  355.  
  356.  
  357.  
  358. /*
  359.  * draw_fantom(-)
  360.  *
  361.  * Purpose:
  362.  * --------
  363.  * Dessine le fant“me d'une ic“ne
  364.  *
  365.  * History:
  366.  * --------
  367.  * 1993: fplanque: Created
  368.  */
  369. void    draw_fantom( int x, int y )
  370. {
  371.     int        i;
  372.     
  373.     /*        printf("%d %d \r", x,y ); */
  374.  
  375.     /*
  376.      * D‚finit le M_motif de Horizontal 
  377.      */
  378.     vsl_udsty( G_ws_handle, M_motif[ y%2 ] );
  379.  
  380.     graf_mouse( M_OFF, 0L );
  381.  
  382.     /*
  383.      * Traits horizontaux: 
  384.      */
  385.     for( i=0; i<=14 ; i +=4)
  386.     {
  387.         v_pline( G_ws_handle, 2, &G_pxyarray[i] );
  388.     }
  389.         
  390.     /*
  391.      * D‚finit le M_motif de Vertical 
  392.      */
  393.     vsl_udsty( G_ws_handle, M_motif[ (x%2)*2 + y%2 ] );
  394.  
  395.     /*
  396.      * Traits verticaux: 
  397.      */
  398.     for( i=2; i<=16 ; i +=4)
  399.     {
  400.         v_pline( G_ws_handle, 2, &G_pxyarray[i] );
  401.     }
  402.  
  403.     graf_mouse( M_ON, 0L );
  404.  
  405. }
  406.  
  407. /*
  408.  * rig_draw_fantom(-)
  409.  *
  410.  * Purpose:
  411.  * --------
  412.  * Dessine le fant“me d'une ic“ne avec rigueur!
  413.  *
  414.  * History:
  415.  * --------
  416.  * 1993: fplanque: Created
  417.  */
  418. void    rig_draw_fantom( void )
  419. {
  420.     int        i;
  421.  
  422.     graf_mouse( M_OFF, 0L );
  423.     
  424.     /* Traits horizontaux: */
  425.     for( i=0; i<=4 ; i +=4)
  426.     {
  427.         /* D‚finit le M_motif de Horizontal */
  428.         vsl_udsty( G_ws_handle, M_motif[ G_pxyarray[i+1] %2 ] );
  429.         /* Traits: */
  430.         v_pline( G_ws_handle, 2, &G_pxyarray[i] );
  431.     }
  432.         
  433.  
  434.     /* Traits verticaux: */
  435.     for( i=2; i<=6 ; i +=4)
  436.     {
  437.         /* D‚finit le M_motif de Vertical */
  438.         vsl_udsty( G_ws_handle, M_motif[ (G_pxyarray[i]%2)*2 + G_pxyarray[i+1]%2 ] );
  439.         /* Taits: */
  440.         v_pline( G_ws_handle, 2, &G_pxyarray[i] );
  441.     }
  442.         
  443.     graf_mouse( M_ON, 0L );
  444.  
  445. }
  446.  
  447.  
  448.  
  449.  
  450. /*
  451.  * draw_proposition(-)
  452.  *
  453.  * Purpose:
  454.  * --------
  455.  * Dessine une proposition de placement
  456.  *
  457.  * History:
  458.  * --------
  459.  * 1993: fplanque: Created
  460.  */
  461. void    draw_proposition( void )
  462. {
  463.  
  464.     graf_mouse( M_OFF, 0L );
  465.  
  466.     /* Traits: */
  467.     v_pline( G_ws_handle, 5, G_pxyarray2 );
  468.  
  469.     graf_mouse( M_ON, 0L );
  470.  
  471. }
  472.  
  473.  
  474.  
  475. /*
  476.  * bouton_croix(-)
  477.  *
  478.  * Purpose:
  479.  * --------
  480.  * Objet USERDEF: Bouton-croix
  481.  *
  482.  * History:
  483.  * --------
  484.  * 1993: fplanque: Created
  485.  */
  486. int cdecl bouton_croix(
  487.                 PARMBLK *parmblock)
  488. {
  489.     /* State: */
  490.     int        ob_prevstate = parmblock -> pb_prevstate;
  491.     int        ob_state      = parmblock -> pb_currstate;
  492.  
  493.     /* Fixe clipping */
  494.     G_cliparray[0] = parmblock -> pb_xc ;
  495.     G_cliparray[1] = parmblock -> pb_yc ;
  496.     G_cliparray[2] = G_cliparray[0] + parmblock -> pb_wc ;
  497.     G_cliparray[3] = G_cliparray[1] + parmblock -> pb_hc ;
  498.     vs_clip( G_ws_handle, 1, G_cliparray );    /*  clipping ON    */
  499.  
  500.     /* Teste s'il faut dessiner le fond de la boŒte: */
  501.     if ( ob_prevstate == ob_state )
  502.     { /* On est en objc draw: */
  503.         /* Params dessin: */
  504.         vsf_color( G_ws_handle, BLACK );        /* Couleur cadre */
  505.         vsf_perimeter( G_ws_handle, 1 );        /* Encadre boŒte */
  506.     
  507.         /* Dessine cadre: */
  508.         G_pxyarray[0] = parmblock->pb_x +1;
  509.         G_pxyarray[1] = parmblock->pb_y +1;
  510.         G_pxyarray[2] = parmblock->pb_w + G_pxyarray[0] -2;
  511.         G_pxyarray[3] = parmblock->pb_h + G_pxyarray[1] -2;
  512.         v_bar( G_ws_handle, G_pxyarray );            /* trace le rectangle */    
  513.  
  514.         vsf_perimeter( G_ws_handle, 0 );        /* N'encadre plus les boites */
  515.     }
  516.  
  517.     /* Trace la croix dedans: */
  518.     /* Params dessin: */
  519.     vsl_type( G_ws_handle, 1 );                /* Trait continu */
  520.     vsl_color( G_ws_handle, (ob_state & SELECTED)?1:0 );    /* Couleur ligne */
  521.  
  522.     /* Dessine croix: */
  523.     G_pxyarray[0] = parmblock->pb_x +2;
  524.     G_pxyarray[1] = parmblock->pb_y +2;
  525.     G_pxyarray[2] = G_pxyarray[0] + parmblock->pb_w -4;
  526.     G_pxyarray[3] = G_pxyarray[1] + parmblock->pb_h -4;
  527.     v_pline( G_ws_handle, 2, G_pxyarray );
  528.     G_pxyarray[4] = G_pxyarray[0];
  529.     G_pxyarray[5] = G_pxyarray[3];
  530.     G_pxyarray[6] = G_pxyarray[2];
  531.     G_pxyarray[7] = G_pxyarray[1];
  532.     v_pline( G_ws_handle, 2, &G_pxyarray[4] );
  533.  
  534.     ob_state &= (!SELECTED);        /* Selected trait‚ */
  535.         
  536.  
  537.     /* Fin de l'affichage */
  538.     vs_clip( G_ws_handle, 0, G_cliparray );    /* clipping OFF */
  539.  
  540.     return ob_state;
  541. }
  542.  
  543.  
  544.  
  545.  
  546. /*
  547.  * draw_grid(-)
  548.  *
  549.  * Purpose:
  550.  * --------
  551.  * Objet USERDEF: Grille arborescence
  552.  *
  553.  * History:
  554.  * --------
  555.  * 1993: fplanque: Created
  556.  */
  557. int cdecl draw_grid(
  558.                 PARMBLK *parmblock)
  559. {
  560.     /* Flags de l'objet: */
  561.     /*    unsigned        ob_flags= parmblock->pb_tree[ parmblock->pb_obj ] .ob_flags; */
  562.     /* State: */
  563.         int        ob_state     = parmblock -> pb_currstate;
  564.     /* Ob_spec: */ 
  565.         OBSPEC    *ob_spec        = (OBSPEC *) &(parmblock -> pb_parm);
  566.         int        framesize    = (ob_spec -> obspec) .framesize;
  567.         unsigned    framecol        = (ob_spec -> obspec) .framecol;
  568.  
  569.         int        min_pos_x, min_pos_y;
  570.         int        max_pos_x, max_pos_y;
  571.     
  572.     /* Fixe clipping */
  573.         G_cliparray[0] = parmblock->pb_xc ;
  574.         G_cliparray[1] = parmblock->pb_yc ;
  575.         G_cliparray[2] = G_cliparray[0] + parmblock->pb_wc -1;
  576.         G_cliparray[3] = G_cliparray[1] + parmblock->pb_hc -1;
  577.         vs_clip( G_ws_handle, 1, G_cliparray );    /*  clipping ON  */
  578.  
  579.     /* Dessine boite de fond */
  580.         G_pxyarray[0] = parmblock->pb_x;
  581.         G_pxyarray[1] = parmblock->pb_y;
  582.         G_pxyarray[2] = G_pxyarray[0] + parmblock->pb_w -1;
  583.         G_pxyarray[3] = G_pxyarray[1] + parmblock->pb_h -1;
  584.         /* Prend en compte l'attribut OUTLINED */
  585.             if ( ob_state & OUTLINED )    
  586.             {    /* Si outlined*/
  587.                 G_pxyarray[ 0 ] -= 2;
  588.                 G_pxyarray[ 1 ] -= 2;
  589.                 G_pxyarray[ 2 ] += 2;
  590.                 G_pxyarray[ 3 ] += 2;
  591.                 ob_state &= (!OUTLINED);    /* Outlined trait‚ */
  592.             }
  593.         v_bar(G_ws_handle,G_pxyarray);            /*  trace le fond */    
  594.  
  595.     /* Frame */
  596.         if ( framesize )
  597.         {    /* Ne gŠre que les cadres int‚rieurs! */
  598.             int    i;
  599.             
  600.             vsl_color( G_ws_handle, framecol );    /* Couleur cadre */
  601.             vsl_type( G_ws_handle, 1 );                /* Trait continu */
  602.  
  603.             G_pxyarray[0] = parmblock->pb_x;
  604.             G_pxyarray[1] = parmblock->pb_y;
  605.         
  606.             G_pxyarray[2] = G_pxyarray[0] + parmblock->pb_w -1;
  607.             G_pxyarray[3] = G_pxyarray[1];        /* Y Haut droit */
  608.  
  609.             G_pxyarray[4] = G_pxyarray[2];        /* X Bas droit */
  610.             G_pxyarray[5] = G_pxyarray[1] + parmblock->pb_h -1;
  611.  
  612.             G_pxyarray[6] = G_pxyarray[0];        /* X Bas gauche */
  613.             G_pxyarray[7] = G_pxyarray[5];        /* Y Bas gauche */
  614.             
  615.             G_pxyarray[8] = G_pxyarray[0];        /* X Haut gauche */
  616.             G_pxyarray[9] = G_pxyarray[1];        /* Y Haut gauche */
  617.  
  618.             v_pline( G_ws_handle, 5, G_pxyarray );    /* Trace cadre std */
  619.  
  620.             for ( i=1; i<framesize; i++ )    /* Passe aux positions suivantes */
  621.             {
  622.                 G_pxyarray[ 0 ] ++;
  623.                 G_pxyarray[ 1 ] ++;
  624.  
  625.                 G_pxyarray[ 2 ] --;
  626.                 G_pxyarray[ 3 ] ++;
  627.  
  628.                 G_pxyarray[ 4 ] --;
  629.                 G_pxyarray[ 5 ] --;
  630.  
  631.                 G_pxyarray[ 6 ] ++;
  632.                 G_pxyarray[ 7 ] --;
  633.  
  634.                 G_pxyarray[ 8 ] ++;
  635.                 G_pxyarray[ 9 ] ++;
  636.  
  637.                 v_pline( G_ws_handle, 5, G_pxyarray );    /* Trace cadre */
  638.             }
  639.         }
  640.  
  641.     /* Quadrillage: */
  642.         vsl_type( G_ws_handle, 1 );                /* Trait Continu */
  643.  
  644.         min_pos_x = parmblock->pb_x +framesize                /* On se place juste aprŠs le bord */
  645.                     +    (parmblock->pb_xc-parmblock->pb_x)     /* Tient compte du d‚calage occasionn‚ par le clipping */
  646.                         / G_arbocell_w * G_arbocell_w;        /* Place sur 1ere colonne affich‚e */
  647.         min_pos_y = parmblock->pb_y +framesize-2
  648.                     +    (parmblock->pb_yc-parmblock->pb_y)    /* Tient compte du d‚calage occasionn‚ par clipping */
  649.                         / G_arbocell_h * G_arbocell_h;
  650.  
  651.         max_pos_x = parmblock->pb_xc +parmblock->pb_wc;
  652.         max_pos_y = parmblock->pb_yc +parmblock->pb_hc;
  653.         
  654.         G_pxyarray[ 0 ] = min_pos_x;
  655.         G_pxyarray[ 2 ] = min_pos_x;
  656.  
  657.         G_pxyarray[ 4 ] = min_pos_x -2;
  658.         G_pxyarray[ 6 ] = G_pxyarray[ 4 ] +4;
  659.  
  660.         while( G_pxyarray[ 0 ] <= max_pos_x )
  661.         {
  662.             G_pxyarray[ 1 ] = min_pos_y;
  663.             G_pxyarray[ 3 ] = min_pos_y +4;
  664.  
  665.             G_pxyarray[ 5 ] = min_pos_y +2;
  666.             G_pxyarray[ 7 ] = G_pxyarray[ 5 ]; 
  667.  
  668.             while ( G_pxyarray[ 1 ] <= max_pos_y )
  669.             {
  670.                 v_pline( G_ws_handle, 2, G_pxyarray );    /* Trace ligne */
  671.                 G_pxyarray[ 1 ] += G_arbocell_h;
  672.                 G_pxyarray[ 3 ] += G_arbocell_h;
  673.  
  674.                 v_pline( G_ws_handle, 2, &G_pxyarray[4] );    /* Trace ligne */
  675.                 G_pxyarray[ 5 ] += G_arbocell_h;
  676.                 G_pxyarray[ 7 ] += G_arbocell_h;
  677.             }
  678.  
  679.             G_pxyarray[ 0 ] += G_arbocell_w;
  680.             G_pxyarray[ 2 ] += G_arbocell_w;
  681.  
  682.             G_pxyarray[ 4 ] += G_arbocell_w;
  683.             G_pxyarray[ 6 ] += G_arbocell_w;
  684.         }
  685.         
  686.     /* Fin de l'affichage */
  687.         vs_clip( G_ws_handle, 0, G_cliparray );    /* clipping OFF */
  688.  
  689.     return ob_state;
  690. }